Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Remove GNU PBDS dependence in stats classes and improve ArgMinMax implementation #75

Merged
merged 2 commits into from
Feb 14, 2024

Conversation

AdamGlustein
Copy link
Collaborator

Summary of changes

  1. Removed PBDS dependence in order statistics. If gcc is being used we used the PBDS tree, if not we use a std::multiset. The downside of this is that for Quantile/Rank, we need to iterate on the set to find the desired value which is O(n). Before, in the PBDS order statistics tree, the complexity of find is O(log n). I did research on replacing the pbds tree and there is no readily available equivalent data structure. I will open an issue as a good starter task for someone to implement a data structure for this use.

  2. Realized I could do ArgMinMax more efficiently. With the pbds tree it was O(log n) insert/delete and find. Using the AscendingMinima monotonic queue, it's O(1) amortized for all those operations.

@AdamGlustein AdamGlustein linked an issue Feb 13, 2024 that may be closed by this pull request
…improved ArgMinMax implementation; using inefficient impl for Quantile/Rank

Signed-off-by: Adam Glustein <[email protected]>
@timkpaine timkpaine added type: enhancement Issues and PRs related to improvements to existing features lang: c++ Issues and PRs related to the C++ codebase labels Feb 13, 2024
cpp/csp/cppnodes/statsimpl.h Outdated Show resolved Hide resolved
…her than we are using gcc

Signed-off-by: Adam Glustein <[email protected]>
@ngoldbaum
Copy link
Collaborator

Cool, once this is merged will compiling with clang work correctly? If so and if you're up to it, you could try adjusting the macos build steps in .github/workflows/build.yml to no longer set CXX to see if clang does actually work correctly on CI.

@AdamGlustein
Copy link
Collaborator Author

Cool, once this is merged will compiling with clang work correctly? If so and if you're up to it, you could try adjusting the macos build steps in .github/workflows/build.yml to no longer set CXX to see if clang does actually work correctly on CI.

Just talked to @timkpaine there are a few more steps to do before clang will work

@timkpaine timkpaine mentioned this pull request Feb 14, 2024
5 tasks
@AdamGlustein AdamGlustein merged commit 8968dbb into main Feb 14, 2024
13 checks passed
@AdamGlustein AdamGlustein deleted the remove-strict-pbds-dependency branch February 14, 2024 14:02
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
lang: c++ Issues and PRs related to the C++ codebase type: enhancement Issues and PRs related to improvements to existing features
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Remove usage of PBDS in stats code
3 participants